/**
 备件管理接口
 **/
import { http } from "@/utils/http";

type ResultTable = {
  total?: number;
  data?: Array<any>;
};

/**
 备件管理-台账接口
 **/
// 查询设备类型树
export const queryEquipTypeTree = (data?: object) => {
  return http.request("post", "/erc/api/v1/type/queryTree", {
    data
  });
};
// 查询设备位置树
export const queryEquipPositionTree = (data?: object) => {
  return http.request("post", "/erc/api/v1/position/queryTree", {
    data
  });
};
// 查询备件台账接口
export const querySparePartsLedger = (data?: object) => {
  return http.request<ResultTable>("post", "/erc/api/v1/sparePart/queryListPage", {
    data
  });
};
// 获取备件台账详情接口
// export const getSparePartsLedger = (data?: object) => {
//   return http.request("post", "/erc/api/v1/sparePart/getSparePart", {
//     data
//   });
// };
// 新增备件台账接口
export const addSparePartsLedger = (data?: object) => {
  return http.request("post", "/erc/api/v1/sparePart/saveSparePart", {
    data
  });
};
// 编辑备件台账接口
export const editSparePartsLedger = (data?: object) => {
  return http.request("post", "/erc/api/v1/sparePart/updateSparePart", {
    data
  });
};
// 删除备件台账接口
export const deleteSparePartsLedger = (data?: object) => {
  return http.request("post", "/erc/api/v1/sparePart/delSparePart", {
    data
  });
};
// 批量删除备件台账接口
export const batchDeleteSparePartsLedger = (data?: object) => {
  return http.request("post", "/erc/api/v1/sparePart/delBatchSparePart", {
    data
  });
};
/**
 备件管理-出库接口
 **/
// 设备列表分页出库接口
export const queryEquipSelect = (data?: object) => {
  return http.request("post", "/erc/api/v1/eqp/queryOptionEqp", {
    data
  });
};
// 查询备件出库接口
export const querySparePartsOutbound = (data?: object) => {
  return http.request<ResultTable>("post", "/erc/api/v1/inventoryOut/queryListPage", {
    data
  });
};
// 查询备件出库编号接口
export const querySparePartsOutboundNum = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryOut/getInventoryOutCode", {
    data
  });
};
// 获取备件出库详情接口
export const getSparePartsOutbound = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryOut/getInventoryOut", {
    data
  });
};
// 新增备件出库接口
export const addSparePartsOutbound = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryOut/saveInventoryOut", {
    data
  });
};
// 编辑备件出库接口
export const editSparePartsOutbound = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryOut/updateInventoryOut", {
    data
  });
};
// 删除备件出库接口
export const deleteSparePartsOutbound = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryOut/delInventoryOut", {
    data
  });
};
// 备件出库用途
export const useSparePartsOutbound = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryOut/getUsedEnumList", {
    data
  });
};
// 备件出库-根据出库单号查询出库备件列表
export const getInventoryOut = (data?: object) => {
  return http.request("post", `/erc/api/v1/inventoryOut/getInventoryOutDetail/${data}`);
};
// 备件出库-查询设备关联备件列表
export const getEqpInventoryOut = (data?: object) => {
  return http.request("post", `/erc/api/v1/eqp/querySparePartByEqpId`, {
    data
  });
};
// 审批状态
export const getApprovalStatus = (data?: object) => {
  return http.request("post", "/erc/api/v1/approvalRecord/getApprovalStatusList", {
    data
  });
};
// 备件出库-审批
export const checkOutbound = (data?: object) => {
  return http.request("post", "/erc/api/v1/approvalRecord/saveInventoryOutApproval", {
    data
  });
};
// 备件出库-转审
export const toCheckOutbound = (data?: object) => {
  return http.request("post", "/erc/api/v1/approvalRecord/saveInventoryOutTransfer", {
    data
  });
};

/**
 备件管理-入库接口
 **/
// 查询备件入库接口
export const querySparePartsWarehousing = (data?: object) => {
  return http.request<ResultTable>("post", "/erc/api/v1/inventoryIn/queryListPage", {
    data
  });
};
// 查询备件入库编号接口
export const querySparePartsWarehousingNum = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryIn/getInventoryInCode", {
    data
  });
};
// 获取备件入库详情接口
export const getSparePartsWarehousing = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryIn/getInventoryIn", {
    data
  });
};
// 新增备件入库接口
export const addSparePartsWarehousing = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryIn/saveInventoryIn", {
    data
  });
};
// 编辑备件入库接口
export const editSparePartsWarehousing = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryIn/updateInventoryIn", {
    data
  });
};
// 删除备件入库接口
export const deleteSparePartsWarehousing = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryIn/delInventoryIn", {
    data
  });
};
// 备件入库来源
export const sourceSparePartsWarehousing = (data?: object) => {
  return http.request("post", "/erc/api/v1/inventoryIn/getSourceEnumList", {
    data
  });
};
// 备件入库-审批
export const checkWarehousing = (data?: object) => {
  return http.request("post", "/erc/api/v1/approvalRecord/saveInventoryInApproval", {
    data
  });
};
// 备件入库-转审
export const toCheckWarehousing = (data?: object) => {
  return http.request("post", "/erc/api/v1/approvalRecord/saveInventoryInTransfer", {
    data
  });
};
// 审批进度查询
export const approvalRecord = (data?: object) => {
  return http.request("post", "/erc/api/v1/approvalRecord/queryApprovalList", {
    data
  });
};
